package cn;

import com.fz.dao.BookDAO;
import com.fz.entity.Book;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.Date;

/**
 * Created by webrx on 2017-09-13.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"classpath:applicationContext.xml"})
public class BookDemo {
    @Autowired
    protected BookDAO bdao;


    //下面是对两种插入方法的测试
    @Test
    public void tt(){
        int a=bdao.save("张三丰",23.5,"2015-5-14");
        System.out.println(a);
    }

    @Test
    public void tf(){
        Book bk=new Book();
        bk.setName("张丽");
        bk.setPrice(15.8);
        bk.setBdate(new Date());
        int b=bdao.add(bk);
        System.out.println(b);
    }
}
